<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="jquery-1.7.1.js"></script>
	<script type="text/javascript">
	    	$(function() {
	    	
	    	
	    		//将苹果替换成菠萝
	    		$(".first").replaceWith("<div>菠萝</div>");
	    		//将菠萝替换成苹果
	    		$(".third").replaceWith("<div class='third'>苹果</div>");
	    		//将苹果替换成菠萝
	    		$(".third").replaceWith("<div>菠萝</div>");
	    	})
	    </script>
	
	</head>
	
	<body>
	    <h3>例子</h3>
	    <div class="container">
	        <div class="first">苹果</div>
	        <div class="second">橘子</div>
	        <div class="third">菠萝</div>
	    </div>
	</body>
	</html>
	